package com.gr100.biz.app.mvc;

import biz.yfsoft.api.ae.api.AEClient;
import biz.yfsoft.api.ae.api.AEParam;
import biz.yfsoft.api.ae.api.AERspType;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.io.IOException;

/**
 * Created by CoderA on 2016/8/5.
 */
public class SyncService {

    private static final Logger logger = LogManager.getLogger(SyncService.class);

    public static synchronized String syncFunction(String method,String paramStr){

        logger.debug("syncFunction:method:" + method);
        logger.debug("syncFunction:paramStr:" + paramStr);
        AEClient _client = new AEClient(method,new AEParam().setJsonStr(paramStr));
        AERspType result = null;
        try {
            result = _client.call();
            return result.toString();
        } catch (IOException e) {
            e.printStackTrace();
            logger.error("syncFunction:ERROR:" + e.getMessage());
        }
        return "{\"errno\":-999}";
    }
}
